package com.lyl.label.controller;


import com.lyl.label.model.dto.LabelGroupDTO;
import com.lyl.label.model.vo.LabelTreeVO;
import com.lyl.label.service.LabelGroupService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 标签组表(LabelGroup)表控制层
 *
 * @author makejava
 * @since 2022-06-20 21:21:39
 */
@RestController
@RequestMapping("labelGroup")
@RequiredArgsConstructor
public class LabelGroupController {
    private final LabelGroupService labelGroupService;

    @GetMapping("/list/{level}")
    public List<LabelGroupDTO> listByLevel(@PathVariable("level") Integer level){
        return labelGroupService.listByLevel(level);
    }

    @GetMapping("/list/{level}/{keyword}")
    public List<LabelGroupDTO> listByLevel(@PathVariable("level") Integer level,@PathVariable("keyword") String keyword){
        return labelGroupService.listByLevel(level,keyword);
    }

    @GetMapping("/labelTree")
    public List<LabelTreeVO> labelTree(String labelName){
        return labelGroupService.labelTree(labelName);
    }
}
